<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta http-equiv="X-UA-Compatible" content="E=edge;chrome=1" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>嘉华金融</title>
<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/reset.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/weui.min.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/index.css">
<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/swiper.min.css">
</head>
<body>
	<div>
		<div class="header">
			<div>
				<!-- <div class="back"></div> -->
			</div>
			<div>首页</div>
			<div>
			<!-- 	<div class="user-img"></div> -->
			</div>
		</div>
		<div class="main">
			<input type="hidden" id="subscribe" value="${userInfo.subscribe}"/>
			<div class="home-banner">
				<div class="swiper-container">
			        <div class="swiper-wrapper">
			            <div class="swiper-slide">
			            	<a class="home-banner-list xjcredit"><img src="<%=path%>/static/img/home/banner2.png" alt=""></a>
			            </div>
			            <div class="swiper-slide">
			            	<a class="home-banner-list xycredit"><img src="<%=path%>/static/img/home/banner3.png" alt=""></a>
			            </div>
			        </div>
			    </div>
			</div>
			<div class="loan-btn">
                <div><div class="button active" code="1" id="btn1">现金贷</div></div>
                <div><div class="button" code="2" id="btn2">信用卡代还</div></div>
            </div>
			<div class="home-wrap">
			  <div class="weui-cells">
				  <c:forEach items="${bPlatfroms}" var="item" varStatus="vs">
				   <c:choose> 
					   <c:when test="${item.name eq '卡卡贷'}">
			            <a class="weui-cell a-bg" code="${item.id}" code2="<%=path %>/${item.url}" onclick="void1(this)">
				       </c:when>
				       <c:otherwise>
		                 <a class="weui-cell a-bg" code="${item.id}" code2="${item.url}" onclick="void1(this)">
				       </c:otherwise>
			       </c:choose>
	                        <div class="weui-cell__hd home-icon" style="background:url('<%=path%>/file/getImg.html?saveAddress=${item.icon}');background-size:100% auto"></div>
	                        <div class="weui-cell__bd home-p">
	                            <p>${item.name}</p>
	                            <p class="home-p-text">${item.description}</p>
	                        </div>
	                        <div class="weui-cell__ft">
	                            <div class="quota">贷款额度</div>
	                            <div class="money">${item.summary}</div>
	                        </div>
	                    </a> 
				  </c:forEach>
				</div>
			</div>
		</div>
	</div>
</body>
<script type="text/javascript" src="<%=path%>/static/js/jquery-3.2.1.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/swiper-3.4.2.jquery.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/weui.min.js"></script>
<script type="text/javascript" src="<%=path%>/static/js/index.js"></script>
<script type="text/javascript" src="<%=path%>/static/layer/layer.js"></script>
<script type="text/javascript">
	 var path="<%=path%>";
	 //var subscribe = $("#subscribe").val();//是否关注	
	 var subscribe = 10;//是否关注	
	 var url;
	 var wx_url = "https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=MzI4NDc4MzM2OQ==&scene=116#wechat_redirect";//微信关注地址
	 var swiper = new Swiper('.swiper-container', {
        loop: true,
        autoplay : 3000,
    });
	 var bannerWidth = 320;
	    var bannerHeight = 152;
	    $(".swiper-container").height($(".swiper-container").width()/(bannerWidth / bannerHeight));

	    $(".button").click(function(){
	    	var type=$(this).attr('code');
		  $.ajax({
	              url:path+"/getPlat.html",
	              data:{
	                  type:$(this).attr('code'),
	               },
	              type : "POST",
	              datatype : "json",
	              async: false,
	              success : function(datas) {
		                var json =JSON.parse(datas);
		                var htmls = "";
		                if(type==2){
		               	  $("#btn1").removeClass("active");
		                  $("#btn2").addClass("active");
		                }else{
		               	  $("#btn2").removeClass("active");
		                  $("#btn1").addClass("active");
		                }
		                $.each(json.bPlatfroms, function (index, item) {
		               	 var url="<%=path%>/file/getImg.html?saveAddress="+item.icon;
		                    var url1=""
		               	 if(item.name=="卡卡贷"){
		               		 url1="<%=path %>/"+item.url;
		               	 }else{
		               		 url1=item.url
		               	 }
		               	 htmls+='<div class="weui-cells"><a class="weui-cell a-bg" code="'+item.id+'" code2="'+url1+'" onclick="void1(this)">'
		               		   +'<div class="weui-cell__hd home-icon" style="background:url('+url+');background-size:100% auto"></div>'
		               	       +'<div class="weui-cell__bd home-p">'
		               	       +'<p>'+item.name+'</p>'
		               	       +'<p class="home-p-text">'+item.description+'</p></div>'
		               	       +'<div class="weui-cell__ft">'
		               	       +' <div class="quota">贷款额度</div>'
		               	       +'<div class="money">'+item.summary+'</div>'
		               	       +'</div></a></div>'; 
		                  });
		                $(".weui-cells").remove();
		                $(".home-wrap").html(htmls);
		              }
		          });
		    });
	    
	var flag=true;
	function void1(obj) {
		if(flag){
			flag=false;
			 $.ajax({
                 url:path+"/home/clickCount.html",
                 data:{
                	 platformId:$(obj).attr('code'),
                	 codeUrl:$(obj).attr('code2')
                  },
                 type : "POST",
                 datatype : "json",
                 async: false,
                 success : function(datas) {
                    flag=true;
                    var json =JSON.parse(datas);
                       window.location=json.data;
                   }
              });
		  }
	};
	
	$(".other").click(function() {
		var $this = $(this);
		layer.msg("功能尚未开放，敬请期待！", {time:1000});
	});
	
	
</script>
</html>